package com.example.jvm.chapter07;

import java.lang.reflect.Method;

/**
 * @Date 2024-01-02
 * @Author Jonathan
 */
public class TestHeroClassLoader {
    public static void main(String[] args) throws Exception {
        HeroClassLoader loader = new HeroClassLoader("D:\\lib");
        Class c = loader.loadClass("com.example.jvm.chapter07.Test");
        if (c != null) {
            Object o = c.newInstance();
            Method method = c.getMethod("test", null);
            method.invoke(o, null);
            System.out.println(c.getClassLoader().toString());
        }
    }
}
